<?php

defined('o') || exit('404 not find file'); //防跳墙

class user extends model{
	public function login($email,$password,&$id,&$name,&$class){
		$sql = "select user_id , user_name ,class_id from xxx_user where user_email='$email' and user_password='$password' limit 1";
		$temp = $this->query($sql,array('user_id','user_name','class_id'),$count);
		if (!empty($temp)) {
			foreach ($temp as $key => $value) {
				$id = $value['user_id'];
				$name = $value['user_name'];
				$class = $value['class_id'];
				break;
			}
		}
		return $count > 0 ? true : false;
	}
	public function create($arr){
		if (is_array($arr)) {
			$addr = isset($_SERVER['SERVER_ADDR'])!=FALSE ? $_SERVER['SERVER_ADDR']:'0.0.0.0';
			$this->adddata(array(
					'user_email'=>$arr['email'],
					'user_name' => '匿名',
					'user_password' => $arr['password'],
					'user_time'=>time(),
					'user_ip'=>$addr,
					'class_id'=>1
				));
		}
	}
}
?>